package com.ry.atomic;

import java.util.concurrent.atomic.AtomicIntegerArray;

//整形数组 保证原子操作
public class AtomicIntegerArrayExp {
    public static void main(String[] args) {
        AtomicIntegerArray array = new AtomicIntegerArray(10);

        array.incrementAndGet(0);

        System.out.println(array.get(0));

        array.decrementAndGet(0);
        System.out.println(array.get(0));


        array.compareAndSet(0,0,333);
        System.out.println(array.get(0));
    }
}
